package calao.client.ui;

import calao.client.util.CalendarDate;

import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

/** A calendar event used in calendar views.
 *
 * @see GanttChart
 */
public class GanttTask 
extends Label
{
	
	CalendarDate start;
	CalendarDate end;
	
	String color;
	
	public GanttTask(String text)
	{
		this();
		setText(text);
	}

	public GanttTask(String text, CalendarDate start, CalendarDate end)
	{
		this();
		setText(text);
		this.start = start;
		this.end = end;
	}
	
	public GanttTask(String text, long startDate, long endDate)
	{
		this(text, new CalendarDate(startDate), new CalendarDate(endDate));
	}

	public GanttTask()
	{
		setWordWrap(false);
		addStyleName("calao-GanttTask");
	}
	
	public CalendarDate getStart()
	{
		return start;
	}
	
	public CalendarDate getEnd()
	{
		return end;
	}
	
	public void setColor(String color)
	{
		Elements.setBackgroundColor(getElement(), color);
	}

	public void setEnd(CalendarDate end) {
		this.end = end;
	}

	public void setStart(CalendarDate start) {
		this.start = start;
	}
	
	public void onClick() { }
	
	public Widget getTooltip()
	{
		return null;
	}

}
